1. Field of the Invention
The present invention relates to an image compressing device and an image compressing method, and particularly to an image compression technique with respect to still pictures.
2. Description of the Related Art
As an international standard concerning compression/expansion method of still pictures, there is available a JPEG method which ISO and CCITT experts group ISO/IEC, JTC1/SC2/WG (Joint photographic Experts Group) has regulated as recommended ITU-T Rec. T81 ISO/IEC-10918-1.
FIG. 1 is an explanatory view conceptually showing compression/expansion processing of the JPEG method. In the compression processing, basically, the image data DI is compressed in three stages; (1) discrete cosine transformation (DCT), (2) quantization, and (3) entropy compression to thereby generate the JPEG compression data DJ. Furthermore, in the expansion processing, on the contrary, the compressed data DJ is expanded at each stage of the (4) each marker detection, (5) entropy expansion, (6) reverse quantization and (7) reverse DCT to thereby create expanded image data DR.
Here, (1) the DCT is a processing of decomposing image data into a frequency coefficient, (2) the quantization is processing of cutting down information quantity in a direction of actively reducing high frequency to which the sensitivity of man's eyes is low from the DCT coefficient data obtained by the DCT, and (3) entropy compression refers to generally known reversible compression/expansion, and in base line DCT, technique based upon the known Huffman encoding regulation is used.
Furthermore, in the JPEG method, there are many cases in which compression/expansion processing is conducted in a color space such as luminance, color difference 1 and color difference 2 (YCbCr, YUV or the like) to further heighten compression rate by changing a sampling ratio in each color space. For example, in the case where the original color image data is composed of three original color, red, green and blue (R, G, B) signal, a method is used in which the color signal is converted into a luminance color difference (Y, Cb, Cr or the like) signal followed by compressing the signal and converted the signal again into R, G, B signal after expansion.
In this method, such a fact is used that the man's eyes are insensitive to the color difference coefficient rather than the luminance coefficient. That is, the data quantity is decreased by reducing the sampling ratio of the color difference coefficient as against the luminance coefficient (thinning out image data) and the compression rate is raised.
An image data unit comprising 8×8 pixels is referred to as a block, also the minimum unit image data for conducting image compression processing is referred to as minimum coded unit (hereinafter referred to as MCU).
FIGS. 2A and 2B are explanatory views schematically showing a relation between data sampling and MCU. There exists a form such as “a sampling ratio of 4:1:1” shown in FIG. 2A for sampling four blocks of luminance signal Y and one block of the color difference signals Cb and Cr respectively from one MCU, or another form such as “a sampling ratio of 4:4:4” shown in FIG. 2B for sampling one block of the luminance signal Y and the color difference signal Cb and Cr respectively from one MCU, or the like.
FIGS. 3A and 3B are views for schematically showing the concept of the image block of the compressed image data of the JPEG method. In the JPEG method, as shown in FIG. 3A, an original image composed of arranging the above described block comprising 8×8 pixels in a vertical and a horizontal direction is subsequently subjected to DCT and quantization in the block unit. From a difference in the characteristic of the first one pixel and other 63 pixels in the each block, as shown in FIG. 3B, the first pixel is referred to as a direct current coefficient (hereinafter referred to as “DC coefficient”) and the remaining 63 pixels are referred to as an alternate current coefficient (hereinafter referred to as “AC coefficient”).
In the DC coefficient and the AC coefficient, the absolute value of the numeric value and the distribution thereof differ from each other. While the absolute value of the AC coefficient is relatively small, the absolute value of the DC coefficient tends to become relatively large. This is because the DC coefficient shows the average value of the block.
In the case where the sampling ratio is 4:4:4 shown in FIG. 2B, the DC coefficient is compressed through entropy coding after determining a differential value with the DC coefficient of the block one ahead for each of the coefficient (Y, Cb, Cr or the like).
As shown in FIG. 3C, a scanning order at the time of sampling the original image in the JPEG method has a specification such that the original image is scanned horizontally from the left to the right in the MCU unit, and when the right end is attained, the scanning process is lowered by one step in the MCU unit so that the original image is scanned horizontally again in the MCU unit from the left to the right so that such process is repeated up to the end of the image data. As shown in FIG. 3C, the AC coefficient is obtained such that values of pixels are scanned in a zigzag manner in the order of 2, 3, 4, . . . 63 and 64 and the values are entropy compressed with a combination of the zero run length (=0 run length value) of the scan data and a coefficient value which is not zero.
The entropy compression is compression on the basis of the Huffman coding regulation. The Huffman table, which is generally used, has a short code length on the whole when the value of each coefficient is smaller. When the value of each coefficient is larger, the code length tends to become longer. Consequently, when the value of each coefficient is smaller, the compression rate becomes higher.
Incidentally, the reason why the DC coefficient assumes a differential value with the DC coefficient of the block one ahead unlike the AC coefficient is that the value at the time of prediction coding as differential information becomes smaller, and the compression rate at the time of entropy compression coding is raised because it is thought that images continue and have a high correlation generally with respect to adjacent DC coefficients.
However, since the DC coefficient always assumes data differential between front and rear blocks, there arises in some cases a problem in that an expansion error is generated in which the following DC coefficient data cannot be accurately expanded in the case of the generation of data error in the communication or the like.
In order to settle this problem, conventionally, a device is made to allow a normal expansion of the MCU next to the restart marker (hereinafter, referred to as “RST”) as shown in FIG. 4A even when data error is caused in the midway rather than inserting the RST in an arbitrary interval of the MCU unit in the data stream.
The RST has a function of disconnecting the chain action of the differential compression associated with the DC coefficient, and the DC coefficient immediately after the RST is designed to entropy coding and compressing the result of taking a differential with zero.
Consequently, in the case where the RST appears at the time of the expansion, a device is made in such a manner that it is not required to calculate the DC coefficient immediately after the RST by using a DC coefficient of the block one ahead, and data can be expanded only with the block.
However, the insertion of the RST into the data stream has an advantage described above while having a problem in that the compression rate of the direct current coefficient of the image is decreased for the following reason.
As described above, the RST once suspends the chain of the differential compression of the DC coefficient to allow data before and after the data to be independent by taking the differential with zero to enable the restart of a normal expansion. Thus, differential value (in actuality the DC coefficient of the block is reflected therein as it is) of the direct current immediately after the insertion of the RST is enlarged. As a result, the compression rate is reduced. In particular, in the case where the RST is inserted into the position where the correlation between front and rear images is strong, a penalty is large in the reduction of the compression rate of the DC coefficient.
FIGS. 4A to 4C schematically show the concept of the RST, a restart interval marker, a RST insertion position by the conventional image compressing apparatus, respectively. As shown in FIG. 4A, the RST comprises 16 bits, and a total of seven kinds of markers exist such as 0×FF, 0×D0 to 0×D6 and 0×D7. (Hereinafter described as RST0, RST1, RST2, . . . RST7 in order of the marker of 0×FF, 0×D0 to 0×D6 and 0×D7).
In the case where the RST is inserted into the image data stream, as shown in FIG. 4C, the RST is inserted in the order of RST0, RST1, RST2, . . . . Nest to the RST7, the RST is inserted again in the order of RST0, RST1 and RST2 . . . .
Incidentally, as shown in FIG. 4B, the insertion interval of the RST is defined at the Ri portion (lower 16 bits and the unit set in the MCU unit) of the restart interval marker (DRI) composed of 48 bits, and is added to the header portion of the JPEG format as restart interval information.
FIG. 5 is a block diagram showing a general conventional image compressing apparatus employing the JPEG method. This conventional image compressing apparatus comprises: a setting register group 1 including a horizontal size setting register 11 for setting a horizontal size of the image and an interval setting register 12 for setting restart interval in a MCU unit or the like; an image compression processing portion 2 for conducting DCT processing and quantization of the image data DI and conducting entropy compression while inserting RST in a set interval; a marker preparation portion 3 for preparing a plurality of kinds of markers including a restart interval marker (DRI) on the basis of the set value of the set register group 1; and a marker addition portion 4 for adding a plurality of kinds of markers to the compressed image data prepared at the image compression processing portion 2 to output the data as JPEG format image data DJ.
The image compression processing portion 2 comprises a DCT portion 21 for conducting DCT processing, a quantization portion 22 for quantization, a RST insertion portion 23 for inserting a restart marker (RST), and an entropy compression portion 24 for conducting entropy compression processing.
The marker preparation portion 3 includes a marker preparing circuit 31 for preparing DRI on the basis of the set value of the interval setting register 12.
Next, referring to FIG. 5, there will be explained an operation of the conventional image compression apparatus and an image compression method. A predetermined set value is set at each of the setting registers 11, 12 of the setting register group 1. That is, the number of horizontal pixels of the image required for compression operation is set in the horizontal size setting register 11. In the interval setting register 12, the restart interval value is set in the MCU unit. Next, the image compression processing portion 2 conducts quantization by subjecting the inputted image data DI to the DCT processing. Furthermore, entropy compression is conducted while inserting the RST in the restart interval that is set in the interval setting register 12.
The marker preparation portion 3 prepares a plurality of kinds of markers on the basis of the set value of the setting register group 1. That is, the marker preparing circuit 31 prepares DRI based on the setting value of the interval setting register 12.
The marker addition portion 4 adds a plurality of kinds of markers including the DRI to the compressed image data prepared at the image compression processing portion 2 to output the data as the JPEG format image data DJ.
As shown in FIG. 3C described above, a scanning order at the time of sampling an original image in the JPEG method is set in such a manner that the original image is scanned from left to right in the scanning line (one line) of MCU unit so that when the scanning attains the right end the scanning is lowered by one line, and an operation of scanning the original image from left to right horizontally by one line is repeated up to the end of the image data.
FIG. 6 schematically shows a concept of correlation of the DC coefficient in the case that the image continues. There will be explained a degree of penalty in the reduction of compression rate by the insertion position of the RST. In the case where the image continues like two images A and B having continuous data, it is thought that a correlation of the DC coefficient showing an average value in the MCU unit is generally high and a differential compression rate is also high, so that a penalty exerting an influence upon the reduction in the compression rate is extremely high at the time of the insertion of the restart marker between these images A and B.
In the image compressing apparatus and the image compressing method which have been described above, a restart marker (RST) is inserted into the data stream in an arbitrary interval of the MCU unit in order to avoid the expansion error of the DC coefficient data caused by the data error. However, the RST has a function of interrupting a chain of a differential compression associated with the DC coefficient. Thus, in the case that the RST is inserted into the position where a correlation between front and rear images is strong, there is a disadvantage in that a differential value of the direct current coefficient immediately after the insertion of RST becomes large. As a result, the compression rate is reduced.
As a related art, Japanese Laid Open Patent Application (JP-A-Heisei, 8-32821) discloses an image compressing system and an image reproduce system. In the image compressing system and the image reproduce system, a partial reproduce of the image data can be performed at high speed.
Also, Japanese Laid Open Patent Application (JPA 2000-32460) discloses a method for producing selective image view and a apparatus thereof. In this technique, a partial image is produced from a large compressed image or a plurality of images.